/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package percussiongenerator.commands;

import org.jfonia.model.PerformanceNode;

/**
 *
 * @author jannes
 */
public class ChangePitchAndVelocity implements ICommand{

    PerformanceNode perNode;
    Integer oldPitch, newPitch;
    int oldVelocity, newVelocity;

    public ChangePitchAndVelocity(PerformanceNode perNode, Integer newPitch, int newVelocity){
        this.perNode = perNode;
        this.newPitch = newPitch;
        this.newVelocity = newVelocity;
    }

    public void execute() {
        oldPitch = perNode.getPitch();
        oldVelocity = perNode.getVelocity();
        perNode.setPitch(newPitch);
        perNode.setVelocity(newVelocity);        
    }

    public void undo() {
        perNode.setPitch(oldPitch);
        perNode.setVelocity(oldVelocity);
    }

}
